package com.zz.services.impl;

import com.github.pagehelper.PageInfo;
import com.zz.dao.ToolsItemDao;
import com.zz.domain.ToolsItem;
import com.zz.services.ToolsItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ToolsItemServiceImpl implements ToolsItemService {
    @Autowired
    ToolsItemDao toolsItemDao;
    //直接获取所有
    @Override
    public PageInfo<ToolsItem> getToolsItemALl() {
        List<ToolsItem> list = toolsItemDao.findToolsItemAll();
        return new PageInfo<>(list) ;
    }
        //根据类型获取
    @Override
    public PageInfo<ToolsItem> getToolsItemByTypeId(int typeId) {
        Map<String,Object> map = new HashMap<>();
        map.put("toolsTypeId",typeId);
        map.put("flag",1);
        List<ToolsItem> toolsItemList =  toolsItemDao.findToolsItemByCondition(map);
        PageInfo<ToolsItem> toolsItemPageInfo = new PageInfo<>(toolsItemList);
        return toolsItemPageInfo;
    }
}
